package com.ssy.lingxi.pay.api.common;

import com.ssy.lingxi.pay.api.dto.response.MapResponse;

import java.util.ArrayList;
import java.util.List;

/**
 * @menu: e账户管理-通联-充值类型
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/12/2
 */
public enum EAccountPCRechargeTypeEnum {
    SCAN_WEIXIN("SCAN_WEIXIN", "微信扫码支付"),
    SCAN_ALIPAY("SCAN_ALIPAY", "支付宝扫码支付"),
    QUICKPAY_VSP("QUICKPAY_VSP", "快捷支付"),
    GATEWAY_VSP("GATEWAY_VSP", "网银支付");

    private String code;
    private String msg;

    EAccountPCRechargeTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMessage(String code) {
        EAccountPCRechargeTypeEnum[] values = EAccountPCRechargeTypeEnum.values();
        for (EAccountPCRechargeTypeEnum allInPayPayMethodEnum : values) {
            if (allInPayPayMethodEnum.code.equals(code)) {
                return allInPayPayMethodEnum.msg;
            }
        }
        return null;
    }

    public static List<MapResponse> getCodes(){
        List<MapResponse> mapResponseList = new ArrayList<>();
        for (EAccountPCRechargeTypeEnum e : EAccountPCRechargeTypeEnum.values()) {
            MapResponse mapResponse = new MapResponse();
            mapResponse.setKey(e.getCode());
            mapResponse.setValue(e.getMsg());
            mapResponseList.add(mapResponse);
        }
        return mapResponseList;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
